<?php
/**
 * @Copyright Copyright (C) 2010-2012
 * @license GNU/GPL http://www.gnu.org/copyleft/gpl.html
 + Created by:          Webit Solution
 * Company:		Webit Solution
 + Contact:		www.webits.asia, developer@webits.asia
 * Created on:	Mar 21, 2012
 ^
 + Project: 		WRecruit
 * File Name:	views/employer/tmpl/alljobsappliedapplication.php
 ^ 
 * Description: template view for my jobs applied application
 ^ 
 * History:		NONE
 ^ 
 */
 
 defined('_JEXEC') or die('Restricted access');
 global $mainframe;
 $document =& JFactory::getDocument();
 $document->addStyleSheet('components/com_wrecruit/css/'.$this->config['theme']);
 $link = 'index.php?option=com_wrecruit&c=wrecruit&view=employer&layout=alljobsappliedapplications&Itemid='.$this->Itemid;
  
?>

<?php if ($this->config['offline'] == '1'){ ?>
<table cellpadding="0" cellspacing="0" border="0" width="100%" >
	<tr><td valign="top" class="<?php echo $this->theme['title']; ?>" >	<?php echo $this->config['title']; ?></td></tr>
	<tr><td height="25"></td></tr>
	<tr><td class="wrecruitmsg">
		<?php echo $this->config['offline_text']; ?>
	</td></tr>
</table>	
<?php }else{ ?>

<table cellpadding="0" cellspacing="0" border="0" width="100%" >
	<tr><td valign="top" class="<?php echo $this->theme['title']; ?>" >	
		<?php echo $this->config['title']; ?>
	</td>
	</tr>
	<tr><td height="23"></td></tr>
	<?php if ($this->config['cur_location'] == 1) {?>
	<tr><td class="curloc">
		<?php echo JText::_('JS_CUR_LOC'); ?> : <?php echo JText::_('JS_APPLIED_RESUME'); ?>
	</td></tr>
	<?php } ?>
	<tr><td>
		<?php 
			if (sizeof($this->employerlinks) != 0){
				echo '<div id="toplinks"><ul>';
				foreach($this->employerlinks as $lnk)	{ ?>
					<span <?php if($lnk[2] == 1)echo 'class="first"'; elseif($lnk[2] == -1)echo 'class="last"';  ?>>
						<a href="<?php echo $lnk[0]; ?>"> <?php echo $lnk[1]; ?></a>
					</span>
				<?php }
				echo '<ul></div>';			
			}
		?>
	</td></tr>	
	<tr><td height="3"></td></tr>
	<tr><td class="<?php echo $this->theme['heading']; ?>" align="center">
		<?php echo JText::_('JS_APPLIED_RESUME'); ?>
	</td></tr>
	<tr><td height="3"></td></tr>
</table>
<?php
if ($this->jobs){
if ($this->userrole->rolefor == 1) { // employer
	if ($this->sortlinks['sortorder'] == 'ASC')
		$img = "components/com_wrecruit/images/sort0.png";
	else
		$img = "components/com_wrecruit/images/sort1.png";
?>

	<table cellpadding="1" cellspacing="0" border="0" width="100%" >
		<tr  class="<?php echo $this->theme['sortlinks']; ?>" height="17" valign="center">
			<td><strong><a class="<?php echo $this->theme['sortlinks']; ?>" href="<?php echo $link?>&sortby=<?php echo $this->sortlinks['title']; ?>"><?php echo JText::_('JS_TITLE'); ?></a></strong><?php if ($this->sortlinks['sorton'] == 'title') { ?> <img src="<?php echo $img ?>"> <?php } ?></td>
			<td><strong><a class="<?php echo $this->theme['sortlinks']; ?>" href="<?php echo $link?>&sortby=<?php echo $this->sortlinks['category']; ?>"><?php echo JText::_('JS_CATEGORY'); ?></a></strong><?php if ($this->sortlinks['sorton'] == 'category') { ?> <img src="<?php echo $img ?>"> <?php } ?></td>
			<td><strong><a class="<?php echo $this->theme['sortlinks']; ?>" href="<?php echo $link?>&sortby=<?php echo $this->sortlinks['jobtype']; ?>"><?php echo JText::_('JS_JOBTYPE'); ?></a></strong><?php if ($this->sortlinks['sorton'] == 'jobtype') { ?> <img src="<?php echo $img ?>"> <?php } ?></td>
			<td><strong><a class="<?php echo $this->theme['sortlinks']; ?>" href="<?php echo $link?>&sortby=<?php echo $this->sortlinks['jobstatus']; ?>"><?php echo JText::_('JS_JOBSTATUS'); ?></a></strong><?php if ($this->sortlinks['sorton'] == 'jobstatus') { ?> <img src="<?php echo $img ?>"> <?php } ?></td>
			<td><strong><a class="<?php echo $this->theme['sortlinks']; ?>" href="<?php echo $link?>&sortby=<?php echo $this->sortlinks['created']; ?>"><?php echo JText::_('JS_DATEPOSTED'); ?></a></strong><?php if ($this->sortlinks['sorton'] == 'created') { ?> <img src="<?php echo $img ?>"> <?php } ?></td>
			<td class="<?php echo $this->theme['sortlinks']; ?>" ><strong><?php echo JText::_('JS_RESUME'); ?>	</strong></td>
		</tr>
		<tr>
		<td colspan="5"></td>
		</tr>
			<?php 
		$tdclass = array($this->theme['odd'], $this->theme['even']);
		$isodd =1;
		foreach($this->jobs as $app)	{ 
			$isodd = 1 - $isodd; ?>
			
			<tr class="<?php echo $tdclass[$isodd]; ?>">
				<td class="maintext"><?php echo $app->title; ?></td>
				<td class="maintext"><?php echo $app->cat_title; ?></td>
				<td class="maintext"><?php echo $app->jobtypetitle; ?></td>
				<td class="maintext"><?php echo $app->jobstatustitle; ?></td>
				<td class="maintext"><?php echo date($this->config['date_format'],strtotime($app->created)); ?></td>
				<td class="maintext">
					<?php $link = 'index.php?option=com_wrecruit&c=wrecruit&view=employer&layout=job_appliedapplications&bd='.$app->id.'&Itemid='.$this->Itemid; ?>
					<a class="pageLink" href="<?php echo $link?>"><?php echo JText::_('JS_RESUME'); echo ' ('.$app->appinjob.')'; ?></a>
				</td>
				
			</tr>
		<?php 
		}
		
		?>		
		
	</table>
<form action="<?php echo JRoute::_('index.php?option=com_wrecruit&c=wrecruit&view=employer&layout=alljobsappliedapplications&Itemid='.$this->Itemid); ?>" method="post">
<table cellpadding="0" cellspacing="0" border="0" width="100%" >
    <tr>
        <td></td>
        <td >
            <?php
            echo $this->pagination->getPagesLinks();
            ?>
        </td>
    </tr>
    <tr>
        <td align="left">
            <?php echo JText::_('JS_DISPLAY_#'); ?>
            <?php
            echo $this->pagination->getLimitBox();
            ?>
        </td>
        <td align="right">
            <?php
            echo $this->pagination->getResultsCounter();
            ?>
        </td>
    </tr>
</table>
</form>	
<?php

} else{ // not allowed job posting
echo JText::_('JS_YOU_ARE_NOT_ALLOWED_TO_VIEW');
}	
}else{ // no result found in this category
	echo JText::_('JS_RESULT_NOT_FOUND');
}
}//ol
?>	
<div width="100%">
<?php 
if($this->config['fr_cr_txsh']) {
	echo 
	'<table width="100%" style="table-layout:fixed;">
		<tr><td height="15"></td></tr>
		<tr><td style="vertical-align:top;" align="center">'.$this->config['fr_cr_txa'].$this->config['fr_cr_txb'].'</td></tr>
	</table>';
}	
?>
</div>

